\ProvidesPackage{lp} % Literature Programming
\RequirePackage{color} % markup the presentation by colors
\openout 3 \jobname.c % Open the auxliary file to save a compilation unit
\openout 2 \jobname.h % Open the auxliary file to save a header unit
% initialize a count for the number of uses
\count10=0
% initialize a count for the number of uses
\count1=0

\newcommand{\printdef}[1]{\immediate\write 3 {struct #1 { int dummy; } ;}}
\newcommand{\printuse}[1]{ \advance\count10 by 1 % increment for the count
\immediate\write 3 {struct #1 a\number\count10 ;}
% immediate output otherwise the number is not incremented by 1
}
\newcommand{\printimp}[1]{\advance\count1 by 1\immediate\openout 4 \jobname\number\count1.h \immediate\write 4 {struct #1 { int dummy; }; } \immediate\closeout 4 \immediate\write 3 {\string ##include "\jobname\number\count1.h" }}
\newcommand{\printexp}[1]{\immediate\write 2 {struct #1 {int dummy; };}}

% definition of a concept
\iflp
\newcommand{\define}[2]{\printdef{#1}\color{red}#2\iflpexplicit\footnote{define:#1}\fi\color{black}}
\else
\newcommand{\define}[2]{#2}
\fi

% usage of a concept
\iflp
\newcommand{\use}[2]{\printuse{#1}\color{green}#2\iflpexplicit\footnote{use:#1}\fi\color{black}}
\else
\newcommand{\use}[2]{#2}
\fi

% exportation of a concept
\iflp
\newcommand{\export}[2]{\printexp{#1}\color{cyan}#2\iflpexplicit\footnote{export:#1}\fi\color{black}}
\else
\newcommand{\export}[2]{#2}
\fi

% importation of a concept
\iflp
\newcommand{\import}[2]{\printimp{#1}\color{yellow}#2\iflpexplicit\footnote{import:#1}\fi\color{black}}
\else
\newcommand{\import}[2]{#2}
\fi

% marker's comments
\iflp
\newcommand{\meta}[1]{\footnote{\color{red}#1\color{black}}}
\else
\newcommand{\meta}[1]{#1}
\fi
